<?php /*
odd and even javascript
*/
//error_reporting(0); 
?>
<html>
<head>
<script type="text/javascript">
function check(){
var first = document.getElementById("first").value;
var second = document.getElementById("second").value;
//document.write(first);
var even='';
var odd='';
var evensum=0;
var oddsum=0;
var counter=0;
var counter1=0;
var eventext = 'List of even numbers';
var oddtext = 'List of odd numbers';
var sumeventext = 'sum of even numbers';
var sumoddtext = 'sum of odd numbers';
var totaleventext = 'total of even numbers';
var totaloddtext = 'total of odd numbers';
var i;
for(i=first; i<=second; i++)
{
 if(i%2==0)
 {
  even = even +"<br>"+ i;
  evensum = parseInt(evensum) + parseInt(i);
  counter++;
 }
 else
 {
 odd = odd +"<br>"+ i;
 oddsum = parseInt(oddsum) + parseInt(i);
 counter1++;
 }
}
//document.write('List of Even Numbers');
document.getElementById("eventext").innerHTML = eventext;
document.getElementById("oddtext").innerHTML = oddtext;
document.getElementById("test").innerHTML = even;
document.getElementById("test1").innerHTML = odd;
document.getElementById("sumeventext").innerHTML = sumeventext;
document.getElementById("testeven").innerHTML = evensum;
document.getElementById("sumoddtext").innerHTML = sumoddtext;
document.getElementById("testodd").innerHTML = oddsum;
document.getElementById("totaleventext").innerHTML = totaleventext;
document.getElementById("counter").innerHTML = counter;
document.getElementById("totaloddtext").innerHTML = totaloddtext;
document.getElementById("counter1").innerHTML = counter1;

}

</script>
</head>
<body>
<form action="ex3.php" method="post">
<input type="text" name="first" id="first" value=" "/>
<input type="text" name="second" id="second" value=" "/>
<input type="button" onclick="check(); return false;" value="find"/>
</form>
<div id="eventext"></div>
<div id="test"></div>
<div id="oddtext"></div>
<div id="test1"></div>
<div id="sumeventext"></div>
<div id="testeven"></div>
<div id="sumoddtext"></div>
<div id="testodd"></div>
<div id="totaleventext"></div>
<div id="counter"></div>
<div id="totaloddtext"></div>
<div id="counter1"></div>
</body>
<html>



